using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using TDV.Controles.Base.WinForm;
using BaseDatos.Comun;
using Aplicacion.Base.WinForm;
using BaseDatos;
using System.Data;
using System.Drawing;
using System.Windows.Forms;


namespace SCHD
{
    [ToolboxBitmap(typeof(ComboBox))]
    public partial class CboCategoria : BaseComboBox
    {
        //public CboCategoria()
        //{
        //    InitializeComponent();
        //    CargarDatos();
        //}

        public CboCategoria(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
            CargarDatos();
        }
        public void CargarDatos()
        {
            try
            {
                this.DataSource = null;
                LBCategoria cat = new LBCategoria();
                cat.Buscar();
                if (cat.Count > 0)
                {
                    DisplayMember = "DescripcionCategoria";
                    ValueMember = "CodigoCategoria";
                    this.DataSource = cat;
                }
            }
            catch (Exception)
            {
                //throw;
            }
        }
    }
}
